load("@rules_java//java:defs.bzl", "java_binary", "java_library")

#package(default_visibility = ["//visibility:public"])

filegroup(
    name = "java_files",
    srcs = glob(["src/main/java/**/*.java",]),
)

filegroup(
    name = "java_resources",
    srcs = glob(["src/main/resources/**"]),
)

java_library(
    name = "app_lib",
    srcs = [":java_files"],
    resources = [":java_resources"],
    deps = [
        "@maven//:org_springframework_boot_spring_boot",
        "@maven//:org_springframework_boot_spring_boot_autoconfigure",
        "@maven//:org_springframework_boot_spring_boot_starter_actuator",
        "@maven//:org_springframework_boot_spring_boot_actuator_autoconfigure",
        "@maven//:org_springframework_boot_spring_boot_starter_web",
        "@maven//:org_springframework_boot_spring_boot_starter_jdbc",
        "@maven//:org_springframework_spring_context",
        "@maven//:org_springframework_spring_web",
        "@maven//:org_springframework_spring_core",
        "@maven//:org_springframework_spring_beans",
        "@maven//:org_springframework_spring_aop",
        "@maven//:org_springframework_spring_expression",
        "@maven//:org_projectlombok_lombok",
        "@maven//:org_slf4j_slf4j_api",
        "@maven//:org_redisson_redisson_spring_boot_starter",
        "@maven//:org_redisson_redisson_spring_data_20",
        "@maven//:org_redisson_redisson",
        "@maven//:com_fasterxml_jackson_dataformat_jackson_dataformat_yaml",
        "@maven//:com_fasterxml_jackson_core_jackson_core",
        "@maven//:com_fasterxml_jackson_core_jackson_databind",
        "@maven//:com_fasterxml_jackson_core_jackson_annotations",
        "@maven//:org_springframework_data_spring_data_redis",
        
         #mybatis
        "@maven//:com_baomidou_mybatis_plus_boot_starter",
        "@maven//:org_mybatis_mybatis",
        "@maven//:org_mybatis_mybatis_spring",
        "@maven//:com_baomidou_mybatis_plus_extension",
        "@maven//:com_baomidou_mybatis_plus_annotation",
        "@maven//:com_baomidou_mybatis_plus_core",

        #jdbc
        "@maven//:mysql_mysql_connector_java",
        "@maven//:com_zaxxer_HikariCP",
    ],
    plugins = [
        ":lombok-java"
    ],
    exported_plugins = [
        ":lombok-java"
    ],
)

java_binary(
    name = "app",
    main_class = "org.yujuan.springbootlearning.SpringbootLearningApplication",
    runtime_deps = [
        ":app_lib",
    ],
)


java_plugin(
    name = "lombok-java",
    processor_class = "lombok.launch.AnnotationProcessorHider$AnnotationProcessor",
    generates_api = True,
    deps = ["@maven//:org_projectlombok_lombok",],
    visibility = ["//visibility:public"],
)